﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace SilverlightGraph.Graph
{
    public class Node
    {
        string _name;
        double _x, _y;
        double _width, _height;
        object _data;
        Label _label;
        List<Attribute> _attributes;
        List<Node> _children;
        public const double DPI = 72; // the default: http://www.graphviz.org/doc/info/attrs.html#points
        Node _parent;

        public Node(string name, double x, double y, double width, double height)
        {
            this._name = name;
            this._label = null;
            this._x = x;
            this._y = y;
            this._width = width * DPI;
            this._height = height * DPI;
            this._attributes = new List<Attribute>();
            this._children = new List<Node>();
            this._data = null;
            this._parent = null;
        }

        public Node(string name, double x, double y, double width, double height, List<Attribute> attributes)
        {
            this._name = name;
            this._label = null;
            this._x = x;
            this._y = y;
            this._width = width * DPI;
            this._height = height * DPI;
            this._attributes = attributes;
            this._children = new List<Node>();
            this._data = null;
            this._parent = null;
        }

        public Node(string name, Label label, double x, double y, double width, double height, List<Attribute> attributes)
        {
            this._name = name;
            this._label = label;
            this._x = x;
            this._y = y;
            this._width = width * DPI;
            this._height = height * DPI;
            this._attributes = attributes;
            this._children = new List<Node>();
            this._data = null;
            this._parent = null;
        }

        public Node(string name, Label label, double x, double y, double width, double height)
        {
            this._name = name;
            this._label = label;
            this._x = x;
            this._y = y;
            this._width = width * DPI;
            this._height = height * DPI;
            this._attributes = new List<Attribute>();
            this._children = new List<Node>();
            this._data = null;
            this._parent = null;
        }

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        public Label Label
        {
            get { return _label; }
            set { _label = value; }
        }

        public double X
        {
            get { return _x; }
            set { _x = value; }
        }

        public double Y
        {
            get { return _y; }
            set { _y = value; }
        }

        public double Width
        {
            get { return _width; }
            set { _width = value; }
        }

        public double Height
        {
            get { return _height; }
            set { _height = value; }
        }

        public List<Node> Children
        {
            get { return _children; }
            set { _children = value; }
        }

        public object Data
        {
            get { return _data; }
            set { _data = value; }
        }

        public Node Parent
        {
            get { return _parent; }
            set { _parent = value; }
        }
    }
}
